package cn.tedu.charging.order.controller;

import cn.tedu.charging.order.common.JsonResult;
import cn.tedu.charging.order.pojo.param.OrderAddParam;
import cn.tedu.charging.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/order")
@Api(tags = "订单接口")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @ApiOperation("创建订单")
    @PostMapping("/created")
    public JsonResult createdOrder(OrderAddParam orderAddParam){
        String orderNo = orderService.createdOrder(orderAddParam);
        JsonResult<String> result = new JsonResult<>();
        result.setCode(2000);
        result.setData(orderNo);
        return  result;
    }
}
